package cn.sourcespro.shiro.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * lr-tree
 *
 * @author zhanghaowei
 * @date 2018/7/7
 */
@Configuration
@EnableSwagger2
@ComponentScan("cn.sourcespro.shiro.controller")
public class Swagger2Config {

    @Bean
    public Docket petApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("我是group name")
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());

    }

    private ApiInfo apiInfo() {
        Contact contact = new Contact("name","http://www.www.www","xxx.xxxx@xxx.com");
        return new ApiInfoBuilder()
                .title("我是标题")
                .version("v1")
                .description("我是介绍")
                .contact(contact)
                .build();
    }

}
